#ifndef RECV_THREAD_H_
#define RECV_THREAD_H_

#include <QThread>
#include "pcap.h"
#include "etherdevice.h"

class ArpTool;
class RecvThread : public QThread
{
	Q_OBJECT
public:
	RecvThread();
	~RecvThread(void);
public:
	void run();
	void stop();
	void setParam(pcap_t *, EtherDevice, ArpTool*);
	bool isDev(const EtherDevice&);
	pcap_t *getPcapHandle()const;
private:
	void arpPacketHandler(const struct pcap_pkthdr *header,
		const struct EtherArpHeader *arp);
signals:
	void findNewMachine(u_int32 ip, u_int32 mac);

private:
	volatile bool stopped;
	pcap_t * adhandle;
	EtherDevice dev;
	ArpTool* arp_tool;
};

#endif